package com.example.skycode5.dao;

import com.example.skycode5.util.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
    //DBConn代表了Mysql数据库sky5链接
    DBConnection DBConn = new DBConnection();
    public  boolean Checklogin(String s1, String s2) throws SQLException {
        Connection conn = DBConn.getConn();
        Statement stmt = conn.createStatement();
        ResultSet rs = null;//结果集
        boolean ok = true;//true登陆成功 false登陆失败
        //todo 密码加密 账户密码过滤
        String sql = "select * from admin where" +  "AdminName"+s1+" and AdminPwd = " + s2;
        rs = stmt.executeQuery(sql);//执行sql语句
        if(!rs.next()){
            ok = false;
        }
        return ok;
    }
}
